﻿using System.Text;

namespace WMS_WEBAPI.Utility
{
    public static class FeiShuRobot
    {
        private static readonly string webhook = "https://open.feishu.cn/open-apis/bot/v2/hook/01096529-a280-4e97-82e6-49ddfd111710";
        public static async Task SendFeishuMessage(string messageText)
        {
            var message = new
            {
                msg_type = "text",
                content = new
                {
                    text = "数据导入系统提醒：" + messageText
                }
            };
            using (var client = new HttpClient())
            {
                var content = new StringContent(System.Text.Json.JsonSerializer.Serialize(message), Encoding.UTF8, "application/json");
                var response = await client.PostAsync(webhook, content);
                if (response.IsSuccessStatusCode)
                {
                    var responseContent = await response.Content.ReadAsStringAsync();
                }
            }
        }
    }
}
